﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel.DataAnnotations;
using System.Text.RegularExpressions;

namespace Adams.Public.DataTransfer
{
    [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
    public class Email : ValidationAttribute
    {
        public Email()
        {
        }

        public override bool IsValid(object value)
        {
            return Adams.Shared.Validation.Email((string)value);
        }
    }

    [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
    public class Integer : ValidationAttribute
    {
        public Integer()
        {
        }

        public override bool IsValid(object value)
        {
            return Adams.Shared.Validation.Integer((string)value);
        }
    }

    [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
    public class Decimal : ValidationAttribute
    {
        public Decimal()
        {
        }

        public override bool IsValid(object value)
        {
            return Adams.Shared.Validation.Decimal((string)value);
        }
    }

    [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
    public class Date : ValidationAttribute
    {
        public Date()
        {
        }

        public override bool IsValid(object value)
        {
            return Adams.Shared.Validation.Date((string)value);
        }
    }

    [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
    public class CreditCard : ValidationAttribute
    {
        public CreditCard()
        {
        }

        public override bool IsValid(object value)
        {
            return Adams.Shared.Validation.CreditCard((string)value);
        }
    }

    [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false)]
    public class Currency : ValidationAttribute
    {
        public Currency()
        {
        }

        public override bool IsValid(object value)
        {
            return Adams.Shared.Validation.Currency((string)value);
        }
    }
}
